<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>登录</title>
		<link rel="stylesheet" type="text/css" href="../CSS/bootstrap.css"/>
		<script src="js/jquery.min.js"></script>
		<style type="text/css">
			body{
				background-color: #C1E2B3;
			}
			legend{
				color: #204D74;
				font-size: calc(40px);
				font-family: "楷体";
				text-align: center;
			}
			label{
				font-size: calc(25px);
			}
			button{
				margin-left: 50px;
				margin-top: 50px;
			}
		</style>
	</head>
	<body>
		<div class="container">
			<fieldset id="">
				<legend>登录</legend>
				<div class="form-group">
					<label for="UserName">用户名</label>
					<input class="form-control" type="text" name="UserName" id="UserName" placeholder="请输入用户名..."/>	
				</div>
				<div class="form-group">
					<label for="password">密码</label>
					<input class="form-control" type="password" name="password" id="password" placeholder="请输入密码..."/>
				</div>
				<div class="form-group">
					<button id="btnSave" class="btn bg-primary" type="button" onclick="save()">保存</button>
					<button id="btnClear" class="btn bg-danger" type="button" onclick="clearmessage()">清除</button>
				</div>
			</fieldset>
		</div>
	</body>
	<script type="text/javascript">
		//点击保存，获取用户名和密码，打印到控制台
		function save(){
			//jQuery,$对应document
			console.log($("#UserName").val());
			console.log($("#password").val());
		}
		//点击清除，清空用户名框和密码框内容
		function clearmessage(){
			$("#UserName").val("");
			$("#password").val("");
		}
		//利用匿名函数
		$("#btnSave").click(function(){
			var username=$("#UserName").val();
			var password=$("#password").val();
			console.log(username+","+password)
		});
		$("#btnClear").click(function(){
			$("#UserName").val("");
			$("#password").val("");
			console.log("匿名函数")
		})
	</script>
</html>
